package com.shujia.wyh.day06.homework.test3;

//书名，作者，出  版社名，价格
public class Book {
    private String bookName;
    private String name;
    private String publishName;
    private double price;

    public Book() {
    }

    public Book(String bookName, String name, String publishName, double price) {
        this.bookName = bookName;
        this.name = name;
        this.publishName = publishName;
        setPrice(price);
    }

    public String getBookName() {
        return bookName;
    }

    public String getName() {
        return name;
    }

    public String getPublishName() {
        return publishName;
    }

    public void setPublishName(String publishName) {
        this.publishName = publishName;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        if (price > 10) {
            this.price = price;
        } else {
            System.out.println("书的价格有误！！");
        }
    }

    public void show() {
        System.out.println("书名：" + bookName);
        System.out.println("作者：" + name);
        System.out.println("出版社：" + publishName);
        System.out.println("价格：" + price + "元");
    }
}
